package com.gxa.service.shezhiservice.Impl;

import com.gxa.common.R;
import com.gxa.service.shezhiservice.LoginService;
import com.gxa.service.shezhiservice.LogoutService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Service;

/**
 * @Author weishen
 */
@Service
public class LogoutServiceImpl implements LogoutService {
    @Override
    public R logout() {
        R r = new R();
        r.setCode(500);
        r.setMsg("退出登录失败");
        Subject subject = SecurityUtils.getSubject();
        if(subject.isAuthenticated())
        {
            subject.logout();
        }
        r.setCode(200);
        r.setMsg("退出登录成功");
        return r;
    }
}
